<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <p>这是一个p标签</p>
    <script>
        //innerText   用    textContent  替换       可读可写
        HTMLElement.prototype.text = innerText;
        function innerText(){    
            if(typeof arguments[0] === 'string'){
                if(this.innerText){
                    this.innerText = arguments[0];
                }else {
                    this.textContent = arguments[0];
                }
            }else {
                if(this.innerText){
                    return this.innerText;
                }else {
                    return this.textContent;
                }
            }
        }
        document.querySelector('p').text('123');
    </script>
</body>
</html>